<!DOCTYPE html>
<html>
<head>
	<title>E8NET</title>
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <include file="./App/Admin/View/Include/css.html" />
    <link href="__PUBLIC__/Admin/css/lib/select2.css" type="text/css" rel="stylesheet" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/compiled/tables.css" type="text/css" media="screen" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>

    <include file="./App/Admin/View/Include/navbar.html" />
    <include file="./App/Admin/View/Include/menu.html" />


	<!-- main container -->
    <div class="content">

        <div class="container-fluid">
            <div id="pad-wrapper">

                <!-- users table -->
                <div class="table-wrapper users-table section">
                    <div class="row-fluid head">
                        <div class="span12">
                            <h4>请假管理</h4>
                        </div>
                    </div>

                    <div class="row-fluid filter-block">
                        <div class="pull-right">
                            <a href="" class="btn-flat pull-right success new-product add-user">+ </a>
                        </div>
                    </div>

                    <div class="row-fluid">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th class="span1">ID</th>
                                <th class="span2">
                                    <span class="line"></span>请假学生
                                </th>
                                <th class="span3">
                                    <span class="line"></span>请假时间
                                </th>
                                <th class="span3">
                                    <span class="line"></span>标题
                                </th>
                                <th class="span2">
                                    <span class="line"></span>内容
                                </th>
                                <th class="span2">
                                    <span class="line"></span>审批老师
                                </th>
                                <th class="span2">
                                    <span class="line"></span>假条状态
                                </th>
                                <th class="span2">
                                    <span class="line"></span>ACTION
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="holidayList" id="holiday" >
                                <tr>
                                    <td>{$holiday.id}</td>
                                    <td>{$holiday.sname}</td>
                                    <td>从<span class="label label-info">{$holiday.stime}</span>开始<br />
                                        到<span class="label label-info">{$holiday.etime}</span>结束</td>
                                    <td>{$holiday.title}</td>
                                    <td>{$holiday.content}</td>
                                    <td>{$Think.session.admin.name}</td>
                                    <td>
                                        <if condition="$holiday.status eq 1">
                                            <span class="label label-success">审批通过</span>
                                        <elseif condition="$holiday.status eq 2" />
                                            <span class="label label-info">审批不通过</span>
                                        <else />
                                            <span class="label">未处理</span>
                                        </if>
                                    </td>
                                    <td class="">
                                        <div class="ui-dropdown">
                                            <div class="head" style="padding:4px; font-size:12px;" data-toggle="tooltip" title="">
                                                审批
                                            </div>
                                            <div class="dialog">
                                                <div class="pointer">
                                                    <div class="arrow"></div>
                                                    <div class="arrow_border"></div>
                                                </div>
                                                <div class="body" style="width:400px;">
                                                    <div class="form" style="">
                                                        <select id="statusSelector" name="status" class="select2">
                                                            <option selected />处理结果
                                                            <option value="1" />同意
                                                            <option value="2" />不同意
                                                        </select>
                                                        <input class="inline-input" name="response" style="width: 210px; margin-left:10px; margin-right:10px;" placeholder="请输入处理意见" type="text" />
                                                        <a href="javascript:holidayHandler({$holiday['id']});" class="btn-flat gray small" style="padding: 4px 14px; margin-top:3px;">提交处理</a>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <a href="javascript:void(0);" onclick="">详细</a>
                                    </td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                    </div>
                </div>
                <!-- end users table -->
                <div class="row ctrls">
                    <div class="pagination pull-right">
                        <ul>
                            {$page}
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- end main container -->

	<include file="./App/Admin/View/Include/js.html" />
    <script src="__PUBLIC__/Admin/js/select2.min.js"></script>


    <script>
        $(function(){

            $(".select2").select2({
                placeholder: "请选择一个选项"
            });

        })


        function holidayHandler (id) {

            var status = $('#statusSelector').val();
            var response = $('input[name=response]').val();

            if (id =='' || status=='' || response=='') {
                alert('请选择处理结果并填写处理意见');
                return;
            }

            $.post("__APP__/Holiday/handler",{id:id,status:status,response:response},function(result){
                var obj = eval('(' + result + ')');
                if (obj.result == 'RESULT_OK') {
                    window.location.href = obj.data;
                } else {
                    alert(obj.msg);
                }
            });
        }
    </script>

</body>
</html>